﻿using GalaSoft.MvvmLight.Messaging;
using JiveMessenger.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace JiveMessenger.Views
{
    /// <summary>
    /// Interaction logic for AddGroup.xaml
    /// </summary>
    public partial class AddGroupWindow : Window
    {
        public AddGroupWindow()
        {
            InitializeComponent();
            Messenger.Default.Register<NotificationMessage>(this, msg =>
            {
                 if (msg.Notification == "CloseWindow" && (msg.Sender == this.DataContext))
                    this.Close();
            });
        }
       

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ((ViewModelAddGroup)this.DataContext).Cleanup();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.TextBoxGroupname.Focus();
        }
    }
}
